package com.mvvm.store.roombatabase;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.mvvm.store.bean.basebean.DeliveryScanInfoBean;
import com.mvvm.store.bean.basebean.StockUpScanInfoBean;

@Database(entities = {DeliveryScanInfoBean.class},version=1,exportSchema = false)
public abstract class DeliveryScanDatabase extends RoomDatabase {

private static final String DB_NAME = "DeliveryScan.db";
private static volatile DeliveryScanDatabase instance;

    /**
     * 备货 bao
     * @param context
     * @return
     */
    public static synchronized DeliveryScanDatabase getInstance(Context context) {
    if (instance == null) {
        instance = create(context);
    }
    return instance;
}

private static DeliveryScanDatabase create(final Context context) {
    return Room.databaseBuilder(
            context,
            DeliveryScanDatabase.class,
            DB_NAME)
            .allowMainThreadQueries()
            .build();

}



    public abstract DeliveryScanDao deliveryScanDao();


}
